/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.wii.elpro.dao.hb;

import com.wii.elpro.dao.DAOGeneric;
import com.wii.elpro.dao.HibernateUtil;
import org.hibernate.Session;

/**
 *
 * @author hendro
 */
public class DAOGenericImpl implements DAOGeneric{

    public void save(Object obj) throws Exception {
        HibernateUtil.beginTransaction();
        Session em = HibernateUtil.getSession();
        try {
            em.save(obj);
        } catch (Exception ex) {
            throw ex;
        }
    }

    public void update(Object obj) throws Exception {
        HibernateUtil.beginTransaction();
        Session em = HibernateUtil.getSession();
        try {
            em.update(obj);
        } catch (Exception ex) {
            throw ex;
        }
    }

    public void delete(Object obj) throws Exception {
        HibernateUtil.beginTransaction();
        Session em = HibernateUtil.getSession();
        try {
            em.delete(obj);
        } catch (Exception ex) {
            throw ex;
        }
    }

}
